package com.eastfair.home.service.impl;

import com.eastfair.builder.ExhibitorFeign;
import com.eastfair.builder.vo.ExhibitorVO;
import com.eastfair.core.base.R;
import com.eastfair.core.exception.BizException;
import com.eastfair.home.service.HomeExhibitorService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 展商 service.
 *
 * @author dqq
 * @date 2023 /4/27
 */
@Slf4j
@Service
public class HomeExhibitorServiceImpl implements HomeExhibitorService {

    @Resource
    private ExhibitorFeign exhibitorFeign;

    @Override
    public ExhibitorVO getExhibitor(Long id) {
        log.info("getExhibitor - ID查询展商详情, id={}", id);
        R<ExhibitorVO> result = exhibitorFeign.getExhibitor(id);
        log.info("getExhibitor - ID查询展商详情, result={}", result);
        if (!result.getIsSuccess()) {
            throw BizException.wrap(result.getCode(), result.getMsg());
        }
        return result.getData();
    }
}